package bbsmsg.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import bbsmsg.Beans.User;
import bbsmsg.biz.IUserbiz;
import bbsmsg.biz.Impl.UserbizImpl;

/**
 * Servlet implementation class checkload
 */
@WebServlet("/checkload")
public class checkload extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public checkload() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out=response.getWriter();
		String name=request.getParameter("username");
		if (name!=null && !"".equals(name)) {
			IUserbiz biz=new UserbizImpl();
			Map<String, String> map=new HashMap<>();
			map.put("user", name);
			User user= biz.getUser(map);
			if(user==null){
				out.print("<font color='red'>�û�����ռ��</font>");
			}
			else {
				out.print("");
			}
		}else {
			out.print("<font color='red'>�û�������Ϊ��</font>");
		}
		out.close();
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
